package com.walogger.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.walogger.domain.Employee;
import com.walogger.service.SampleService;

@Controller
public class SampleController {
	@Autowired
	SampleService sampleService;

	@RequestMapping(value = "/demo")
	public String sayHello(Model model) {
		model.addAttribute("employees", sampleService.getAll());
		return "sample/crud_demo";
	}
	@RequestMapping(value = "/create")
	public String createEmployee(@ModelAttribute(value="emp") Employee employee) {
		System.out.println(employee.getName());
		return "sample/crud_demo";
	}
}